﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("个人信息：");
            Console.WriteLine("姓名：曾婷");
            Console.WriteLine("性别：女");
           string dt_str = "2001-01-18";
            DateTime dt = Convert.ToDateTime(dt_str);
            DateTime now = DateTime.Now;
            int age = now.Year - dt.Year;
            if(now.Month<dt.Month)
            {
                age--;
            }
            else if(now.Month==dt.Month&&now.Day<dt.Day)
            {
                age--;
            }
            Console.WriteLine("年龄："+ age);
            DateTime dt1 = DateTime.Now;
            DateTime dt2 = new DateTime(2001, 1, 18);
            TimeSpan ts = dt1 - dt2;
            Console.WriteLine("已来人间："+ ts+"天");

            DateTime dt3 = DateTime.Now;
            DateTime dt4 = new DateTime(2021, 1, 18);
            TimeSpan by = dt4 - dt3;
            Console.WriteLine( "距离下一次生日还有："+by+"天");


            var arr = "夏日炎炎，有你真甜！";
            Console.WriteLine("字符串的长度为：" + arr.Length);
            Console.WriteLine("字符串中第一个字符为：" + arr[0]);
            Console.WriteLine("字符串中最后一个字符为：" + arr[arr.Length - 1]);
            var indexArr = arr.IndexOf("你");
            Console.WriteLine(indexArr);
        }
    }
}
